#include<stdio.h>
char hex2char(int h)
{
    if ( h <= 9 )
        return '0' + h;
    else
        return 'A' + h - 10;
}

char *print_hex(unsigned int h)
{
    char str[10];
    int i;
    for (i = 0; i < 8; ++i )
        str[i] = hex2char((h >> 4 * (7-i)) & 0xf);
    str[8] = '\0';
    return &str[0];
}

int main(int argc, char *argv[])
{
    char *str = print_hex(111);
    printf("%s\n", str);
    return 0;
}
